#include<iostream.h>
void menu();
class stack
			  {
				private:
							int a[10],top;
				public:
						  void push(int);
						  int pop();
						  int isfull();
						  int isempty();
						  void displaystack();
						  stack();
			  };
stack::stack()
				{ top=0;}

void stack::push(int x)
			 {
				if(isfull())
				 { a[top]=x;    top++;   }
				else
					 cout<<"\nstack is full\n";
			 }

int stack::pop()
			{
				if(isempty())
				{  top--;  return a[top];   }
				else
					 cout<<"\nstack is empty\n";
			 }

int stack::isfull()
			{
			  if(top==10)
							 return 0;
				else  return 1;
			 }
int stack::isempty()
			{
			  if(top==0)
							return 0;
			  else return 1;
			}
void stack::displaystack()
			 {
				int i;
				for(i=top-1;i>=0;i--)
					 cout<<a[i]<<"\t";
			  }
int main()
	{
	 int x,c,y;
	 stack s1;
	 menu();
	 cin>>c;
	 while(c!=4) {
						switch(c){
									 case 1:
											  cin>>x;   s1.push(x);   break;
									 case 2:
											  y=s1.pop();             break;
									 case 3:
											  s1.displaystack();       break;
									 }
						  menu();
						  cin>>c;
					 }
  return 0;
	}

void menu()
{
cout<<"\n1.insert item\n2.delete item\n3.print item\n4.exet\n";
}
